﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using WlanDesign;

namespace WlanDesignDll
{
    public partial class FormBuildingSet : Form
    {
        public FormBuildingSet()
        {
            InitializeComponent();
        }

        private void FormBuildingSet_Load(object sender, EventArgs e)
        {
        }

        private void btn_Do_Click(object sender, EventArgs e)
        {
            Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
            Database db = doc.Database;
            string floor = this.tBox_Floor.Text;
            if (floor == "")
            {
                MessageBox.Show("楼层不能为空！");
                return;
            }
            // ini文件与当前文档在同一目录下，并且名字相同
            //string[] name = acDoc.Name.Split('.');
            //string iniName = name[0] + ".ini";

            string[] name1 = doc.Name.Split('.');
            string iniName1 = name1[0] + ".ini";
            // 写入ini文件
            WriteIniTxt(iniName1, "floor", "building_floor", floor);

            this.Close();
        }

        //
        // Summery
        // 加载信息到ini文件
        //
        public void WriteIniTxt(string sPath, string Section, string Key, string value)
        {
            string ServerName = value;

            IniFileRW ini = new IniFileRW(sPath);

            ini.IniWriteValue(Section, Key, ServerName);
        }
    }
}
